package com.googlecode.garbagecan.dbtest;
import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.PreparedStatement;
import java.sql.ResultSet;
import java.text.ParseException;
import java.text.SimpleDateFormat;
import java.util.Calendar;
import java.util.Date;
import java.util.Properties;
import java.util.Timer;
import java.util.TimerTask;

public class Test {

	public static void main(String[] args) throws Exception {
		final SimpleDateFormat sdf = new SimpleDateFormat("yyyy-MM-dd HH:mm:ss");
		int a = 24 * 60 * 60 * 1000 * 365;
		long b = 24 * 60 * 60 * 1000 * 365;
		System.out.println(a);
		System.out.println(b);
	}

	public static void testMySQL() throws Exception {
		Class.forName("org.apache.derby.jdbc.ClientDriver");
		String url = "jdbc:derby://172.17.1.178:1527/app;user=app;password=app";
		Connection conn = DriverManager.getConnection(url);

		String s = "ab''c";
		String sql = "select * from test21 where t1='" + s + "'";
		PreparedStatement ps = conn.prepareStatement(sql);
		ResultSet rs = ps.executeQuery();
		System.out.println(rs.getRow());
		rs.close();
		conn.close();
	}

	public static void testGetConnection() throws Exception {
		Class.forName("oracle.jdbc.driver.OracleDriver");
		String url = "jdbc:oracle:thin:@172.17.1.178:1521/ORCL";
		Connection conn = DriverManager.getConnection(url, "fkong", "fkong");

		String sql = "select count(*) from test1";
		PreparedStatement ps = conn.prepareStatement(sql);
		ResultSet rs = ps.executeQuery();

		rs.next();
		System.out.println(rs.getInt(1));

		rs.close();
		conn.close();
	}

}
